<?php


namespace App\Api\Fcjd;
use PhalApi\Api;
use PhalApi\Exception\BadRequestException;

/**
 * 中控取二维码
 *
 * @author: dogstar <chanzonghuang@gmail.com> 2014-10-04
 */
class Getfile extends Api
{

    public function getRules()
    {
        return array(
            'adminqr' => array(),
            'cientqr' => array(),
            'safeqr' => array()
        );
    }


    /**
     * adminqr
     */
    public function adminqr()
    {
        $list = \PhalApi\DI()->notorm->phone_banner
        ->select('*')
        ->where(array('state' => 1, 'category' => 'qr', 'used' => 'admin' ))
        ->order('id DESC')     // 同type内按id降序
        ->fetchOne();
        return $list;
    }

    /**
     * cientqr
     */
    public function cientqr()
    {
        $list = \PhalApi\DI()->notorm->phone_banner
        ->select('*')
        ->where(array('state' => 1, 'category' => 'qr', 'used' => 'client' ))
        ->order('id DESC')     // 同type内按id降序
        ->fetchOne();
        return $list;
    }

    /**
     * safeqr
     */
    public function safeqr()
    {
        $list = \PhalApi\DI()->notorm->phone_banner
        ->select('*')
        ->where(array('state' => 1, 'category' => 'qr', 'used' => 'safe' ))
        ->order('id DESC')     // 同type内按id降序
        ->fetchOne();
        return $list;
    }

}
